package cn.zbmao.web.interceptor.user;

import cn.zbmao.web.log.LoggerFactory;
import com.alibaba.fastjson.JSON;
import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;

import javax.servlet.http.HttpServletRequest;

public class UserIntercepter implements Interceptor {
    /**
     * 拦截并打印日志，访问时可以看到用户传递的参数
     * @param ai
     */
	@Override
	public void intercept(ActionInvocation ai) {
		HttpServletRequest request = ai.getController().getRequest();
		LoggerFactory.initNewsLogger().info("Parameter:"+ JSON.toJSONString(request.getParameterMap())+"***"+"ActionKey:"+ai.getActionKey());
		ai.invoke();
	}

}
